<%--
  Created by IntelliJ IDEA.
  User: 宝玉丶
  Date: 2017/7/19
  Time: 13:10
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>项目导出</title>
    <%--<meta name="keywords" content="">--%>
    <%--<meta name="description" content="">--%>

    <%--<link rel="shortcut icon" href="favicon.ico"> --%>

    <link href="<c:url value="/resources/hplus/lib/css/bootstrap.min.css?v=3.3.6"/>" rel="stylesheet">
    <link href="<c:url value="/resources/hplus/lib/css/font-awesome.css?v=4.4.0"/>" rel="stylesheet">

    <link href="<c:url value="/resources/hplus/lib/css/animate.css"/>" rel="stylesheet">
    <link href="<c:url value="/resources/hplus/lib/css/style.css?v=4.1.0"/>" rel="stylesheet">

    <link href="<c:url value="/resources/hplus/lib/css/plugins/sweetalert/sweetalert.css"/>" rel="stylesheet">
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content  animated fadeInRight">
    <div class="row">
        <div class="col-sm-4">
            <div class="ibox">
                <div class="ibox-content">
                    <h3>待选择列表</h3>
                    <p class="small"><i class="fa fa-hand-o-up"></i> 在列表之间拖动任务面板</p>

                    <%--<div class="input-group">--%>
                        <%--<input type="text" placeholder="添加新任务" class="input input-sm form-control">--%>
                            <%--<span class="input-group-btn">--%>
                                        <%--<button type="button" class="btn btn-sm btn-white"> <i class="fa fa-plus"></i> 添加</button>--%>
                                <%--</span>--%>
                    <%--</div>--%>

                    <ul class="sortable-list connectList agile-list">
                        <%--<li class="success-element">--%>
                            <%--加强过程管理，及时统   &lt;%&ndash;<a href="#" class="pull-right btn btn-xs btn-warning">删除</a>&ndash;%&gt;--%>
                        <%--</li>--%>
                        <c:forEach items="${systemAuthorityList}" var="systemAuthority">
                            <li class="success-element" mapkey="${systemAuthority.id}">
                                ${systemAuthority.authorityDescription}
                            </li>
                        </c:forEach>

                    </ul>
                </div>
            </div>
        </div>
        <div class="col-sm-4">
            <div class="ibox">
                <div class="ibox-content">
                    <h3>已选择列表</h3>
                    <p class="small"><i class="fa fa-hand-o-up"></i> 在列表之间拖动任务面板</p>
                    <ul class="sortable-list connectList agile-list selFieldList">
                        <c:forEach items="${authoritySet}" var="authority">
                            <li class="success-element" mapkey="${authority.id}">
                                    ${authority.authorityDescription}
                            </li>
                        </c:forEach>
                    </ul>
                </div>
            </div>
        </div>
        <div class="col-sm-4">
            <div class="ibox">
                <div class="ibox-content">
                    <h3>操作</h3>
                    <%--<p class="small"><i class="fa fa-hand-o-up"></i> 在列表之间拖动任务面板</p>--%>
                    <div class="row">
                        <div class="col-sm-12">
                            <button type="button" class="btn btn-w-m btn-success" id="submit-base-info">保存</button>
                            <button type="button" class="btn btn-w-m btn-default" id="back-cp">返回</button>
                            <%--<button type="button" class="btn btn-w-m btn-default" id="return-proj-list">返回列表</button>--%>
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div>


</div>
<script src="<c:url value="/resources/hplus/lib/js/jquery.min.js?v=2.1.4"/>"></script>
<script src="<c:url value="/resources/hplus/lib/js/bootstrap.min.js?v=3.3.6"/>"></script>
<script src="<c:url value="/resources/hplus/lib/js/jquery-ui-1.10.4.min.js"/>"></script>
<script src="<c:url value="/resources/hplus/lib/js/content.js?v=1.0.0"/>"></script>

<script src="<c:url value="/resources/hplus/lib/js/plugins/sweetalert/sweetalert.min.js"/>"></script>
<script>
    $(document).ready(function(){
        $(".sortable-list").sortable({connectWith:".connectList"}).disableSelection()

        $("#back-cp").click(function () {
            window.location.href = "<c:url value="/admin/system/role/list.action"/>";
        });

        $("#submit-base-info").click(function () {

            var elementList = "";
            $(".selFieldList li").each(function (index, ele) {
                index == 0 ? elementList += $(ele).attr('mapkey') : elementList += (',' + $(ele).attr('mapkey'));
            });
            $.post("<c:url value="/admin/system/role/assign.action"/>", {elements : elementList, id : ${id}}, function(data) {
                if(data.status == 0) {
                    window.location.href = "<c:url value="/admin/system/role/list.action"/>";
                }else {
                    swal("操作失败！",data.msg,"error");
                }
            }, 'JSON');
        });
    });
</script>
</body>
</html>
